home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl / 5.10.0 / Pod / Simple / HTMLLegacy.pm < prev    next >
Encoding:
Text File  |  2009-06-26  |  2.7 KB  |  105 lines

  1.  
  2. require 5;
  3. package Pod::Simple::HTMLLegacy;
  4. use strict;
  5.  
  6. use vars qw($VERSION);
  7. use Getopt::Long;
  8.  
  9. $VERSION = "5.01";
  10.  
  11. #--------------------------------------------------------------------------
  12. # This class is meant to thinly emulate bad old Pod::Html
  13. #
  14. # TODO: some basic docs
  15.  
  16. sub pod2html {
  17.   my @args = (@_);
  18.   
  19.   my( $verbose, $infile, $outfile, $title );
  20.   my $index = 1;
  21.  
  22.   {
  23.     my($help);
  24.  
  25.     my($netscape); # dummy
  26.     local @ARGV = @args;
  27.     GetOptions(
  28.       "help"       => \$help,
  29.       "verbose!"   => \$verbose,
  30.       "infile=s"   => \$infile,
  31.       "outfile=s"  => \$outfile,
  32.       "title=s"    => \$title,
  33.       "index!"     => \$index,
  34.  
  35.       "netscape!"   => \$netscape,
  36.     ) or return bad_opts(@args);
  37.     bad_opts(@args) if @ARGV; # it should be all switches!
  38.     return help_message() if $help;
  39.   }
  40.  
  41.   for($infile, $outfile) { $_ = undef unless defined and length }
  42.   
  43.   if($verbose) {
  44.     warn sprintf "%s version %s\n", __PACKAGE__, $VERSION;
  45.     warn "OK, processed args [@args] ...\n";
  46.     warn sprintf
  47.       " Verbose: %s\n Index: %s\n Infile: %s\n Outfile: %s\n Title: %s\n",
  48.       map defined($_) ? $_ : "(nil)",
  49.        $verbose,     $index,     $infile,     $outfile,     $title,
  50.     ;
  51.     *Pod::Simple::HTML::DEBUG = sub(){1};
  52.   }
  53.   require Pod::Simple::HTML;
  54.   Pod::Simple::HTML->VERSION(3);
  55.   
  56.   die "No such input file as $infile\n"
  57.    if defined $infile and ! -e $infile;
  58.  
  59.   
  60.   my $pod = Pod::Simple::HTML->new;
  61.   $pod->force_title($title) if defined $title;
  62.   $pod->index($index);
  63.   return $pod->parse_from_file($infile, $outfile);
  64. }
  65.  
  66. #--------------------------------------------------------------------------
  67.  
  68. sub bad_opts     { die _help_message();         }
  69. sub help_message { print STDOUT _help_message() }
  70.  
  71. #--------------------------------------------------------------------------
  72.  
  73. sub _help_message {
  74.  
  75.   join '',
  76.  
  77. "[", __PACKAGE__, " version ", $VERSION, qq~]
  78. Usage:  pod2html --help --infile=<name> --outfile=<name>
  79.    --verbose --index --noindex
  80.  
  81. Options:
  82.   --help         - prints this message.
  83.   --[no]index    - generate an index at the top of the resulting html
  84.                    (default behavior).
  85.   --infile       - filename for the pod to convert (input taken from stdin
  86.                    by default).
  87.   --outfile      - filename for the resulting html file (output sent to
  88.                    stdout by default).
  89.   --title        - title that will appear in resulting html file.
  90.   --[no]verbose  - self-explanatory (off by default).
  91.  
  92. Note that pod2html is DEPRECATED, and this version implements only
  93.  some of the options known to older versions.
  94. For more information, see 'perldoc pod2html'.
  95. ~;
  96.  
  97. }
  98.  
  99. 1;
  100. __END__
  101.  
  102. OVER the underpass! UNDER the overpass! Around the FUTURE and BEYOND REPAIR!!
  103.  
  104.